﻿using BunnyEater.Common.Jwt.Dto;
using BunnyEater.Common.ResponseOutput;
using BunnyEater.Domain.Base;
using BunnyEater.Domain.SystemManagement;
using BunnyEater.Service.SystemManagementService.UserService.Dto;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BunnyEater.Service.SystemManagementService.UserService
{
    public interface IUsersService : ITransientService
    {
        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="loginRequest">登录信息传参</param>
        /// <returns></returns>
        Task<ResponseReturnsEntity<LoginRequest>> Login(LoginRequest loginRequest);

        /// <summary>
        /// 添加用户
        /// </summary>
        /// <param name="userRequest">用户信息请求体</param>
        /// <returns>新增用户数据的记录数是否>0</returns>
        Task<ResponseReturnsEntity<bool>> AddUser(UserRequest userRequest);
        /// <summary>
        /// 修改用户
        /// </summary>
        Task<ResponseReturnsEntity<bool>> UptUser(UserRequest userRequest);
        /// <summary>
        /// 主键获取用户
        /// </summary>
        Task<ResponseReturnsEntity<User>> GetUserById(string id);
        /// <summary>
        /// 获取用户详情（包含角色信息）
        /// </summary>
        /// <param name="id">用户Id</param>
        /// <returns>用户详情（包含角色列表）</returns>
        Task<ResponseReturnsEntity<UserDetailDto>> GetUserDetailById(string id);
        /// <summary>
        /// 删除用户
        /// </summary>
        Task<ResponseReturnsEntity<bool>> DeleteUser(UserDto userDto);
        /// <summary>
        /// 修改状态
        /// </summary>
        Task<ResponseReturnsEntity<bool>> UpdateUserState(UserRequest userDto);

        /// <summary>
        /// 分页查询用户列表
        /// </summary>
        /// <param name="query">分页查询参数</param>
        /// <returns>分页用户列表</returns>
        Task<ResponseReturnsEntity<Page<UserListDto>>> GetPagedUsersAsync(UserPagedQueryDto query);

        /// <summary>
        /// 五表联查：获取用户及其角色和权限信息
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <returns>用户-角色-权限结构</returns>
        Task<UserRolePermissionDto> GetUserRolePermissions(string userId);
    }
}
